<script>
	common.setMainTitle('Chi tiết nội dung LIÊN HỆ');
</script>
<form id="mainform" name='frmDetailContact' method=post action="">
    <table style="margin-top: 10px" border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
        <thead>
            <tr class="alternate-row">
                <th colspan="2" style="text-align: left;padding-left: 10px;font-size: 24px;">TIÊU ĐỀ : <?=$this->viewmessage['TITLE']?></th>
            </tr>
        </thead>
        <tbody>
       		<tr>
       			<td style="padding: 10px 200px 10px 10px;line-height: 20px">
       				<div style="word-wrap: break-word;width: 700px;height: auto;"><?=$this->viewmessage['CONTENT']?></div>
       			</td>
       		</tr>
       		<tr>
       			<td> 				
       					<div class="detailmessage-c1">
       						<ul>
       							<li>TÊN NGƯỜI GỬI :</li>
       							<li>EMAIL NGƯỜI GỬI:</li>
       							<li>ĐIỆN THOẠI :</li>
       							<li>ĐỊA CHỈ :</li>
       							<li>NGÀY GỬI :</li>
       						</ul>
       					</div>
       					<div class="detailmessage-c2">
       						<ul>
       							<li id="vluename" ><?=$this->viewmessage['NAME']?></li>
       							<li id="vlueemail"><?=$this->viewmessage['EMAIL']?></li>
       							<li><?=$this->viewmessage['PHONE']?></li>
       							<li><?=$this->viewmessage['ADDRESS']?></li>
       							<li><?=$this->viewmessage['SENT_DATE']?></li>
       						</ul>
       				
       					</div>
				</td>
       		</tr>
        </tbody>
    </table>
</form>
<form id="frmsendmail" name="frmsendmail" method="POST" action="" enctype="multipart/form-data" >
<table style="margin-top: 10px" border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
<tbody>
	<tr>
       	<td id="retryemail" style="padding-left: 20px">
       		<img alt="" src="/images/sala/author.png" class="imginputstyle">
       		<input type="text" readonly="readonly" value="Trả lời tin nhắn với <?=$this->viewmessage['NAME']?>" class="inputstyle" onclick="addformretryemail()"></input>
       	</td>
    </tr>

</tbody>
</table>
</form>

<script>
function isread(id){
	common.loadAjaxPushState('/contact/admin/view/id/'+id);
}
function back(){
	common.loadAjaxPushState('/contact/admin/index');
}
function addformretryemail(){
	// create Element 
	var vluename = document.getElementById('vluename').innerHTML;
	var vluename = vluename.split(" ");
	var vluename = vluename.join("&nbsp;");
	var vlueemail = document.getElementById('vlueemail').innerHTML;
	var retryemail = document.getElementById('retryemail').innerHTML=
		"<input type='text' readonly='readonly' style='width:500px;height:25px;border:1px solid #e6e2e2' value="+vlueemail+'('+vluename+')'+" name='USERMAIL' id='USERMAIL'>"+
		"<div style='clear:bold'></div>"+
		"<textarea class='ckeditor' cols=60 rows=8 style='margin-top:10px;overflow:auto' name='CONTENT' id='CONTENT'></textarea>"+
		"<div style='clear:bold'></div>"+
		"<input type='button' onclick='sendmail()' value='Trả lời' style='margin-top:10px;float:left'>"+
		"<div id='message' style='margin-top:12px;margin-left:10px;float:left'></div>";
}
function sendmail(){
	var user = document.getElementById('USERMAIL').value;
	var cont = document.getElementById('CONTENT').value;
	jx.setParameter('USERMAIL',user);
	jx.setParameter('CONTENT',cont);
	jx.success('doit');
	jx.request('/contact/admin/sendmail','POST');
	$('#message').html('&nbsp;<img src="/images/sala/progressbar.gif" align="absmiddle">').fadeIn('fast');
}
function doit(){
	if(result == 1){
		$('#message').fadeTo(200,01,function(){
			$(this).html('<b>Gửi mail thành công</b>').fadeTo(200,1);
		});
	}
	else{
		$('#message').fadeTo(200,01,function(){
			$(this).html('<b>Gửi mail chưa thành công</b>').fadeTo(200,1);
		});
	}
}
</script>